import request from '@/utils/request'
// 频道 - 用户已选列表
const getUserChannelListAPI = () => {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}
// 文章列表
const getArticlelistAPI = ({ channelId, timestamp = Date.now() }) => {
  return request({
    method: 'get',
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp
    }
  })
}

// 文章 - 不感兴趣
const dislikeArticleAPI = ({ artId }) => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'post',
    data: {
      target: artId
    }
  })
}

// 文章 - 举报
const reportArticleAPI = ({ target, type, remark }) => {
  return request({
    url: '/v1_0/article/reports',
    method: 'post',
    data: {
      target,
      type,
      remark
    }
  })
}

// 所有频道
const getAllChannelListAPI = () => {
  return request({
    method: 'get',
    url: '/v1_0/channels'
  })
}
// 更新
const updatedAPT = ({ channels }) => {
  return request({
    method: 'put',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}
export {
  getUserChannelListAPI,
  getArticlelistAPI,
  dislikeArticleAPI,
  reportArticleAPI,
  getAllChannelListAPI,
  updatedAPT
}
